pfsense에 설치된 Suricata와 Wazuh Manager 연결

pfsense에 설치된 Suricata와 Wazuh Manager 연결

Description
동아리 서버에 IDS 실습
category
ETC
Tag
Server
pfsense
Date
Feb 20, 2024 01:18 AM
생각보다 간단하지만 한글로 정리된 곳이 없어서 정리해 봅니다!다른 환경은 사용할 수 있다는 전제하에 Suricata와 Wazuh와의 연결만 알려드립니다.

네트워크 구축도

notion image
우선 pfsense 환경부터 설정해 주도록 하자
pfsense에 suricata가 설치되어 있지 않으면 참고하세요
우선 pfsense의 2.6.0버전 이상이여야한다.
pfsense에 Wazuh agent를 설치하기 위해서 FreeBSD repositories를 활성화 시켜준다.
vi /usr/local/etc/pkg/repos/FreeBSD.conf
해당 라인의 enabled 값을 YES로 변경해준다.
FreeBSD: { enabled: yes  }
해당 파일도 변경해준다.
vi /usr/local/etc/pkg/repos/pfSense.conf
FreeBSD: { enabled: yes  }
FreeBSD를 활성화 시켜주었으면 pkg update를 진행해준다.
pkg update
sample output
Updating FreeBSD repository catalogue... Fetching meta.conf: 100%    163 B   0.2kB/s    00:01 Fetching packagesite.pkg: 100%    6 MiB   1.7MB/s    00:04 Processing entries: 100% FreeBSD repository update completed. 33014 packages processed. Updating pfSense-core repository catalogue... pfSense-core repository is up to date. Updating pfSense repository catalogue... pfSense repository is up to date. All repositories are up to date.
성공적으로 update 되었다면 이제 wazuh-agent를 설치해보자
pkg 검사를 통해 wazuh-agent를 검색해본다.
pkg search wazuh-agent
sample output
wazuh-agent-4.3.10_1           Security tool to monitor and check logs and intrusions (agent)
wazuh-agent 설치
pkg install wazuh-agent
sample output
Updating FreeBSD repository catalogue... FreeBSD repository is up to date. ... ... ===== Message from wazuh-agent-4.3.10_1: -- Wazuh Agent was installed 1) Copy /etc/locatime to /var/ossec/etc directory    # cp /etc/localtime /var/ossec/etc 2) You must edit /var/ossec/etc/ossec.conf.sample for your setup and rename/copy    it to ossec.conf    Take a look wazuh configuration at the following url:    https://documentation.wazuh.com/current/user-manual/index.html 3) You can find additional useful files installed at   # /var/ossec/packages_files/agent_installation_scripts 4) Add Wazuh agent to /etc/rc.conf   # sysrc wazuh_agent_enable="YES" 5) Start Wazuh agent   # service wazuh_agent start 6) Enjoy it ;)
설치가 완료되었다면 이제 wazuh-agent에서 suricata의 eve.json파일을 전송하게 설정해준다.
참고로 eve.json의 파일 위치는 /var/log/suricata/*/eve.json 이런식으로 위치해 있다.
vi /var/ossec/etc/ossec.conf
우선 wazuh 서버의 ip를 입력해준다.
<server>       <address>"Wazuh-server-ip"</address> </server>
Log analysis 부분에 eve.json를 전송하게 추가해준다.
<!-- Log analysis --> <localfile>     <log_format>json</log_format>     <location>/var/log/suricata/*/eve.json</location> </localfile>
설정은 끝났고 Wazuh-agent를 실행시켜보자
/var/ossec/bin/wazuh-control start
sample output
Starting Wazuh v4.3.10... Started wazuh-execd... Started wazuh-agentd... 2022/12/21 20:47:01 wazuh-syscheckd: WARNING: The check_unixaudit option is deprecated in favor of the SCA module. Started wazuh-syscheckd... Started wazuh-logcollector... Started wazuh-modulesd... Completed.
그럼 이제 Wazuh Manager에서 Suricata log를 확인해보자
필터링 해준 화면이다. 잘 들어오는 것을 볼 수 있다.
notion image
끝!